@extends('admin.layout')
@section('content')

<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                电影管理
                <small>添加</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>后台主页</a></li>
                <li><a href="#">电影</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title"> 快速添加电影</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/cate/insert') }}" method="post" enctype="multipart/form-data">
                        	{{ csrf_field() }}
                            <div class="box-body">
		                   	@if(count($errors) > 0)
		                        <div class="alert alert-danger alert-dismissable">
									<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
									<h4><i class="icon fa fa-ban"></i>警告</h4>
									@foreach($errors->all() as $error)
											<li>{{$error}}</li>
									@endforeach
								</div>
							@endif
                                <div class="form-group">
                                    <label for="exampleInputname">选择类型</label><br />
                                    电影:<input type="radio" name="type" value="0">
                                    电视:<input type="radio" name="type" value="1">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">电影名,英文名</label>
                                    <input type="text" name="name" value="{{ old('name') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：我们这种叛徒,Our Kind of Traitor">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">电影时长</label>
                                    <input type="text" name="timelong" value="{{ old('timelong') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：100分钟">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">电影年代</label>
                                    <input type="text" name="time" value="{{ old('time') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：2016">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">导演</label>
                                    <input type="text" name="director" value="{{ old('director') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：沈严">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">编剧</label>
                                    <input type="text" name="scriptwriter" value="{{ old('scriptwriter') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：沈严,陈建斌">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">主演</label>
                                    <input type="text" name="cast" value="{{ old('cast') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：演员们,英文名,角色名|演员们,英文名,角色名|演员们,英文名,角色名">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">发行公司</label>
                                    <input type="text" name="publish" value="{{ old('publish') }}" class="form-control" id="exampleInputUsername"
                                           placeholder="如：霍尔果斯春秋时代文化传媒有限公司">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">地区</label>
                                    <select class="form-control" name="path">
                                        <option value="中国   ">中国</option>
                                        <option value="香港">香港</option>
                                        <option value="台湾">台湾</option>
                                        <option value="美国">美国</option>
                                        <option value="韩国">韩国</option>
                                        <option value="泰国">泰国</option>
                                        <option value="英国">英国</option>
                                        <option value="印度">印度</option>
                                        <option value="新加坡">新加坡</option>
                                        <option value="加拿大">加拿大</option>
                                        <option value="澳大利亚">澳大利亚</option>
                                        <option value="其他">其他</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputname">电影类型</label>
                                    <div class="form-group">
                                        <div class="checkbox">
                                            <style type="text/css">
                                                .che
                                                {
                                                    margin-right: 20px;
                                                }
                                            </style>
                                            <label class="che" style="margin-left: 10px;">
                                                <input type="checkbox" name="pid[]" value="动作">
                                                动作
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="爱情">
                                                爱情
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="喜剧">
                                                喜剧
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="恐怖">
                                                恐怖
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="科幻">
                                                科幻
                                            </label class="che">
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="悬疑">
                                                悬疑
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="惊悚">
                                                惊悚
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="战争">
                                                战争
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="武侠">
                                                武侠
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="文艺">
                                                文艺
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="犯罪">
                                                犯罪
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="灾难">
                                                灾难
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="动画">
                                                动画
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="奇幻">
                                                奇幻
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="冒险">
                                                冒险
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="剧情">
                                                剧情
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="家庭">
                                                家庭
                                            </label>
                                            <label class="che">
                                                <input type="checkbox" name="pid[]" value="其他">
                                                其他
                                            </label>

                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputFile">海报</label>
                                    <input id="exampleInputFile" type="file" name="photo">
                                </div>
                                <div>
                                    <h4 class="box-title">剧情简介
                                        <!-- <small>发行公司、导演编剧及主演</small> -->
                                    </h4>
                                    <div class="box-body pad">
                                            <textarea style="width: 100%; height: 151px; resize: none;" id="editor1" name="synopsis" rows="10" cols="80" placeholder="剧情简介"></textarea>
                                    </div>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
                </div><!--/.col (left) -->     
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
<script type="text/javascript">
    $('input[name="time"]').on('blur', function(){
        //获取输入的值
        var v = this.value;
        // console.log(v);
        //声明正则
        var reg = /^\d{4}$/;
        //验证
        var res = reg.test(v);
        //判断
        if(res)
        {
            this.style.border = '1px solid #0f0';
        }else {
            this.style.border = '2px solid #f00';
        }
    })
</script>
@endsection